home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1996 / MacHack 1996.toast / Presentations / Presentations ’88 / Fritz Proceedings stuff / setLDEF.a < prev    next >
Encoding:
Text File  |  1988-06-14  |  2.4 KB  |  136 lines  |  [TEXT/KAHL]

  1.     Case    On
  2.     Print    Off
  3.     Include    'QuickEqu.a'
  4.     Include    'SysEqu.a'
  5.     Include     'traps.a'
  6.     Print    On
  7.  
  8.     Export    Draw
  9.  
  10. ;*********************************************************
  11. ;  4/2/88     FFA —    Added _ClipRect call
  12. ;*********************************************************
  13.  
  14.     
  15. ;**************************************
  16. ;    Cell data structure
  17. ;**************************************
  18. CellData    Record    0
  19. cdString    DS.B    1    ; Length byte of a string.
  20.     EndR
  21.  
  22. ;**************************************
  23. ;    Stack structure
  24. ;**************************************
  25. drFrame    Record    {A6Save},Decr
  26. cellWid    DS.W    1
  27. cellHt    DS.W    1
  28. cRect    DS.L    1
  29. hCells    DS.L    1
  30. downSet    DS.L    1
  31. offset    DS.L    1
  32. rtnAdr    DS.L    1
  33. A6Save    DS.L    1
  34. oldPen    DS.B    psRec    ; Constant = 18 in QuickEqu
  35. lclSize    Equ    *
  36.     EndR
  37.  
  38. Draw    Proc
  39.     With    drFrame,CellData
  40.     
  41.     Link    A6,#lclSize
  42.     MoveM.L    D3/D4/A2/A3,-(SP)
  43.     
  44.     Pea    oldPen(A6)
  45.     _GetPenState
  46.     _PenNormal
  47.     Pea    grayPat
  48.     _PenPat
  49.     
  50.     MoveA.L    cRect(A6),A3    ; A3 <- Rect
  51.     Move.L    A3,-(SP)
  52.     _EraseRect            ; Blank the Rect
  53.     
  54.     Move.L    A3, -(SP)
  55.     _ClipRect
  56.     
  57.     Move.W    left(A3),D0
  58.     AddQ.W    #2,D0
  59.     Move.W    D0,-(SP)        ; Margin + left
  60.     Move.L    downSet(A6),D0
  61.     Add.W    top(A3),D0        ; Top + clearance
  62.     Move.W    D0,-(SP)
  63.     _MoveTo
  64.     
  65.     MoveA.L    hCells(A6),A0    ; cells (handle)
  66.     Move.L    A0,D4        ; Save userHandle
  67.     _HLock
  68.     MoveA.L    (A0),A0
  69.     Move.L    offset(A6),D0    ; offset
  70.     Lea    $0(A0,D0.L),A2    ; A2 <- cell data
  71.     
  72.     Move.L    A2, -(SP)        ; Push addr of string
  73.     _DrawString            ; Draw it.
  74.     
  75.     Move.L    D4,A0        ; Unlock userHandle
  76.     _HUnlock
  77.     
  78.     Move.L    (A3),D4        ; D4 = topLeft
  79.     Move.L    D4,D3        ; Determine full-cell rect.
  80.     Add.W    cellWid(A6),D3
  81.     Swap    D3
  82.     Add.W    cellHt(A6),D3
  83.     Swap    D3        ; D3 = botRight
  84.     Sub.L    OneOne,D3
  85.     Move.L    D3,D0        ; Bottom...
  86.     Move.W    D4,D0        ; ... Left
  87.     Move.L    D0,-(SP)
  88.     _MoveTo
  89.     Move.L    D3,-(SP)        ; Bottom Right
  90.     _LineTo
  91.     Move.L    D4,D0        ; Top...
  92.     Move.W    D3,D0        ; ...Right
  93.     Move.L    D0,-(SP)
  94.     _LineTo
  95.     
  96.     Pea    oldPen(A6)
  97.     _SetPenState
  98.     
  99.     MoveM.L    (SP)+,D3/D4/A2/A3
  100.     Unlk    A6
  101.     Rts
  102. grayPat    DC.B    $AA,$55,$AA,$55,$AA,$55,$AA,$55
  103.     
  104.     EndWith
  105.     EndProc
  106.  
  107. ;*********************************************************
  108. ;    Defined here so we don't have to link with
  109. ;    the MPW Libraries:
  110. ;*********************************************************
  111.  
  112. HLock    Proc    Export
  113.     Move.L    4(SP), A0
  114.     _HLock
  115.     Rts
  116.     EndProc
  117.     
  118. HUnlock    Proc    Export
  119.     Move.L    4(SP), A0
  120.     _HUnlock
  121.     Rts
  122.     EndProc
  123.  
  124. PtrToHand    Proc    Export
  125.     Move.L    4(SP), A0    ; source Pointer
  126.     Move.L    12(SP), D0    ; Length of source
  127.     
  128.     _PtrToHand
  129.     
  130.     Move.L    8(SP), A1    ; Pointer to destination handle
  131.     Move.L    A0, (A1)    ; Fill destination with handle
  132.     Rts
  133.     EndProc
  134.  
  135.     End
  136.